<script setup>
import { Search, Edit, Delete } from '@element-plus/icons-vue'
import { ref } from 'vue'
const tableData = ref([
  {
    username: 'user1',
    nickname: 'nickname1',
    role: 'admin',
    create_time: '2021-10-01'
  },
  {
    username: 'user2',
    nickname: 'nickname2',
    role: 'user',
    create_time: '2021-10-01'
  }
  // 更多数据...
])
</script>

<template>
  <el-card class="box-card" style="padding: 30px">
    <template #header>
      <div class="card-header">
        <span style="font-weight: bold">用户管理</span>
        <el-button class="button" type="success" style="float: right"
          >添加用户</el-button
        >
      </div>
    </template>
    <el-form inline>
      <el-row :gutter="20">
        <el-col :span="6">
          <el-form-item label="用户昵称">
            <el-input
              v-model="input1"
              class="w-50 m-2"
              placeholder="请输入用户昵称"
              :suffix-icon="Search"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="用户角色" class="vertical-center">
            <el-select v-model="value" class="m-2" placeholder="请选择">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="排序方式">
            <el-select v-model="value" class="m-2" placeholder="最新发布">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item>
            <el-button type="primary" :icon="Search">搜索</el-button>

            <el-button type="info" plain>重置</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <el-divider style="margin-top: 0"></el-divider>
    <el-table :data="tableData" stripe>
      <el-table-column
        type="selection"
        width="100"
        align="center"
      ></el-table-column>
      <el-table-column
        width="80"
        type="index"
        label="序号"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="username"
        label="用户名"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="nickname"
        label="用户昵称"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="role"
        label="角色"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="create_time"
        label="创建日期"
        :formatter="deleteUserFormatter"
        align="center"
      ></el-table-column>
      <el-table-column label="操作" fixed="right" align="center">
        <template #default="{ row }">
          <el-button-group>
            <el-button type="primary" size="mini" :icon="Edit"></el-button>
            <el-button type="danger" size="mini" :icon="Delete"></el-button>
          </el-button-group>
        </template>
      </el-table-column>
    </el-table>

    <template #footer>
      <el-pagination
        :page-size="20"
        :pager-count="11"
        layout="prev, pager, next"
        :total="1000"
        style="justify-content: center; margin-bottom: -25px"
      />
    </template>
  </el-card>
</template>

<style scoped></style>
